package com.huadao.cart_ccs.modle;

import com.huadao.cart_ccs.base.BaseSerialPortModel;
import com.huadao.cart_ccs.common.ByteUtils;
import com.huadao.cart_ccs.data.bo.CommandWord;
import com.huadao.cart_ccs.data.bo.IncubatorBO;
import com.huadao.cart_ccs.data.bo.Protocol;

/**
 * 培养箱电机
 */
public class IncubatorModle extends BaseSerialPortModel {

    private String TAG="培养箱电机";

    public void openMagneticStirrer(){
        setMagneticStirrer(IncubatorBO.star);
    }

    public void closeMagneticStirrer(){
        setMagneticStirrer(IncubatorBO.stop);
    }

    private void setMagneticStirrer(byte order){
        byte[] orderContent;
        if(order== IncubatorBO.star) {//启动
            orderContent = new byte[]{00};
        }else {//停止
            orderContent = new byte[]{00};
        }
        Protocol params = ByteUtils.generateProtocol(CommandWord.write, new byte[]{IncubatorBO.ModularType_VacuumPump, IncubatorBO.VacuumPump_incubator,order}, orderContent);
        serialPortRequest(params);
    }
}
